package com.xfhy.selectcity.adapter;

import com.ludashi.framework.adapter.BaseMultiItemQuickAdapter;
import com.ludashi.framework.adapter.BaseViewHolder;
import com.xfhy.selectcity.R;

import java.util.List;

/**
 * @author : xfhy
 * Create time : 2021/2/25 19:20
 * Description :
 */
public class SelectProvinceAdapter extends BaseMultiItemQuickAdapter<BaseAreaType, BaseViewHolder> {

    public SelectProvinceAdapter(List<BaseAreaType> data) {
        super(data);
        addItemType(BaseAreaType.AREA_TITLE, R.layout.item_select_province_title);
        addItemType(BaseAreaType.AREA_ITEM, R.layout.item_select_city);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, BaseAreaType baseAreaType, int index) {
        if (baseAreaType.getItemType() == BaseAreaType.AREA_TITLE) {
            baseViewHolder.setText(R.id.tv_title_name, baseAreaType.content);
        } else {
            baseViewHolder.setText(R.id.tv_city_name, baseAreaType.content);
        }
    }
}

